package com.yy.jhl.ui.manager.presenter;

import com.google.gson.Gson;
import com.yy.jhl.api.Api;
import com.yy.jhl.api.RxSubscriber;
import com.yy.jhl.app.AppConstant;
import com.yy.jhl.bean.CGSOrderInfoList;
import com.yy.jhl.bean.MessageListInfo;
import com.yy.jhl.ui.manager.contract.MenuTwoJGContract;
import com.yy.jhl.ui.manager.contract.MessageListContract;

import java.util.HashMap;
import java.util.Map;

import okhttp3.FormBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * Created by libingn on 2017/12/14.
 */

public class MenuTwoJGPresenter extends MenuTwoJGContract.Presenter {
    @Override
    public void getOrderList(int status, int page_size, boolean isDialog) {
        Map<String,Object> requestMap = new HashMap<>();
        requestMap.put("status",status);
        requestMap.put("page_size",AppConstant.PAGE_SIZE);
        requestMap.put("page",page_size );
        mRxManage.addSubscription(Api.getDefault().cgsGetOrderList(requestMap), new RxSubscriber<ResponseBody>(mContext,isDialog) {
            @Override
            protected void _onNext(String result) {
                CGSOrderInfoList info = new Gson().fromJson(result,CGSOrderInfoList.class);
                mView.getOrderListSuccess(info.getData());
            }

            @Override
            protected void _onError(String message) {
                mView.getOrderListFail();
            }
        });
    }
}
